﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Xml;

namespace Intel_Client_GUI
{
	public class SQLCmdCollections :INotifyPropertyChanged
	{
		public SQLCmdCollections()
		{
			// 在此点下面插入创建对象所需的代码。
			//System.Windows.MessageBox.Show("Create");
			this.SQLCmds = new ObservableCollection<SQLCmd>();
			var Doc = new XmlDocument();
			try
			{
				Doc.Load("SQLCmd.xml");
				var Root = Doc.SelectSingleNode("/SQLCommands");
				if(Root!=null)
				{
					//System.Windows.MessageBox.Show(Root.ChildNodes.Count.ToString());
					foreach(XmlNode Child in Root.ChildNodes)
					{
						this.SQLCmds.Add(new SQLCmd(Child));
					}
				}
			}
			catch(System.Exception ex)
			{
				System.Windows.MessageBox.Show(ex.Message);
			}
			
		}
		
		public ObservableCollection<SQLCmd>SQLCmds {set;get;}
		
		public void Serilize()
		{
			//System.Windows.MessageBox.Show("aa");
		}
		
		#region INotifyPropertyChanged
		public event PropertyChangedEventHandler PropertyChanged;
		
		private void NotifyPropertyChanged(String info)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(info));
			}
		}
		#endregion

	}
}